define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
    var Controller = {
        index: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: 'thirdparty/index' + location.search,
                    multi_url: 'wanlshop/goods/multi',
                    table: 'wps_goods',
                }
            });

            var table = $("#table");
            // 初始化表格
            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'id',
                sortName: 'id',
                fixedColumns: true,
                fixedRightNumber: 1,
                columns: [
                    [
                        {checkbox: true},
                        {field: 'id', title: __('Id')},
                        {field: 'c_goods_name', title: '商品名称'},
                        {field: 'c_goods_image', title: '商品图片', formatter:Table.api.formatter.image},
                        {field: 'c_start_datetime', title: '上架时间'},
                        {field: 'c_stop_datetime', title: '下架时间'},
                        {field: 'c_sale_price', title: '建议售价'},
                        {field: 'c_in_price', title: '商品进货价格'},
                        {field: 'c_original_price', title: '商品原价(吊牌)'},
                        {field: 'c_company_code', title: '供应商编码'},
                        {field: 'c_brand_name', title: '品牌名称'},
                        {field: 'c_brand_icon', title: '品牌图标', formatter:Table.api.formatter.image},
                        {field: 'c_goods_stock_start', title: '原始库存'},
                        {field: 'c_goods_stock_valid', title: '当前库存'},
                    ]
                ]
            });
            // 为表格绑定事件
            Table.api.bindevent(table);
        },
        api: {
            bindevent: function () {
                Form.api.bindevent($("form[role=form]"));
            }
        }
    };
    return Controller;
});